// -------------------------
// 内容工具栏 Toolbar
// -------------------------
var toolbarDivId = "toolbar";
// 内容工具栏按钮
var mainToolbarItems = [
    ['img_text', toolbarImgRelateLoc + 'new.png', 'newMeeting()', '召开会议'],
    ['separator', toolbarImgRelateLoc + 'separator_blank.png', '', ''],
    ['img_text', thisRelateLoc + 'assistant/meeting.png', 'meetingMgr()', '会议列表'],
    ['separator', toolbarImgRelateLoc + 'separator.png', '', ''],
    ['img_text', thisRelateLoc + 'assistant/meeting_room.png', 'meetingRoomMgr()', '会议室管理']
];
// 靠右边的工具栏按钮
var rightToolbarItems = [
    /*
    ['img_only', toolbarImgRelateLoc + 'print.png', 'print()', ''],
    ['separator', toolbarImgRelateLoc + 'separator_blank.png', '', ''],
     */
    ['img_only', toolbarImgRelateLoc + 'help.gif', 'help()', '']
];

////////////////////////////////////////////////////////////////////////////////
// -------------------------
// 会议相关内容
// -------------------------
var assetPanel = {
    panelId: "assetPanel",
    grid: new SysGrid(),
    gridName: "assetPanel.grid",
    gridId: "assetGrid",
    // 会议 Panel
    // 会议 Panel 工具按钮
    toolbarItems: [
        ['img_only', panelImgRelateLoc + 'new.png', 'addMeeting()', ''],
        ['separator', panelImgRelateLoc + 'separator_blank.png', '', ''],
        ['img_only', panelImgRelateLoc + 'arrow_refresh_small.png', 'refresh()', '']
    ],
    // 会议 Panel 标题
    titleItems: [
        ['img_text', panelImgRelateLoc + 'bullet_arrow_down.png', 'setShowHide', '固定资产列表']
    ]
};
function assetInit(bean, width_, height_) {
    $("#" + bean.panelId + "_content").html(
    "<div id='" + bean.gridId + "'/>");
    var header = [
        {align:'center', label:'ID', width:30, type:'checkbox'},
        {align:'left', label:'名称', type:'script', script:'editMeeting'},
        {align:'left', label:'召集人', width:120},
        {align:'left', label:'日期', width:110},
        {align:'left', label:'会议室', width:120},
        {align:'left', label:'时间', width:120},
        {align:'left', label:'描述', width:0},
        {align:'left', label:'操作员', width:0},
        {align:'left', label:'创建时间', width:0},
        {align:'left', label:'修改时间', width:0}
    ];
    var tbConfig = {
        url: 'stringRes?s=meetingServletAction&a=list', 
        imgRelateLoc: 'style/powerhua/platform/systable/default_skin/images/', 
        width: width_, height: height_};
    bean.grid.init(bean.gridName, bean.gridId, header, tbConfig);

    $.get(bean.grid.dataUrl, {}, function(result) {
        bean.grid.ajaxCall(result);
    });
}


////////////////////////////////////////////////////////////////////////////////
// -------------------------
// 
// -------------------------
var assetEditorPanel = {
    panelId: "meetingEditorPanel",
    toolbarItems: [
        ['img_only', panelImgRelateLoc + 'save.png', 'saveMeeting()', '保存'],
        ['separator', panelImgRelateLoc + 'separator_blank.png', '', ''],
        ['img_only', panelImgRelateLoc + 'table.png', 'listMeeting()', '']
    ],
    // 会议 Panel 标题
    titleItems: [
        ['img_text', panelImgRelateLoc + 'bullet_arrow_down.png', 'setShowHide()', '编辑会议信息']
    ],
    eidtorAction: "save", // 会议室保存动作是 save 还是 update
    //
    editorUrl: 'stringRes?s=htmlBodyContentAction&file_path=oa/assistant/meeting_editor.html'
}
function assetEditorInit(bean) {
    $("#" + bean.panelId + "_content").html(
    "<div id='meetingEditor'/>");
    $.get(bean.editorUrl, {}, function(result) {
        $("#meetingEditor").html(result);
        $("#MEditorForm").submit(function() {
            $(this).ajaxSubmit({
                url: "stringRes?s=coreBaseManagerServletAction&i=MeetingModel&a=" + bean.editorAction,
                type: "post",
                success: function() {
                    alert("success");
                } 
            });
            return false;
        });
    });
}


////////////////////////////////////
// action
////////////////////////////////////
function editAssetUI() {
    $("#" + assetPanel.panelId).css("display", "none");
    $("#" + assetEditorPanel.panelId).css("display", "block");
}
function listAssetUI() {
    $("#" + assetPanel.panelId).css("display", "block");
    $("#" + assetEditorPanel.panelId).css("display", "none");
}
function addAsset() {
    editAssetUI();
}
function editAsset(grid, rowNum) {
    editAssetUI();
}
function listAsset() {
    listAssetUI();
}